import { cipher } from '@lhy-assist/utils'

const config: Record<string, any> = cipher.decodeJSON((process as any).config)

// 当前环境
export const nodeEnv: string = config.NODE_ENV

// 是否开发环境
export const isDev = /^dev[elopment]?/i.test(nodeEnv)

// 应用名称
export const appName = config.appName

// 应用命名空间
export const appNamespace = appName

// 环境+应用名称。可用于区分localStorage命名等
export const appEnvNamespace = `${nodeEnv}-${appName}`

// api地址
export const api: string = config.api

// 图片域名
export const imageDomain = config.imageDomain

// 等于publicPath
export const baseURL = config.BASE_URL || '/'

// element-plus 命名空间
export const elNamespace = config.elNamespace || 'el'
// 获取element-plus的类名
export const getElClass = (...names: string[]) => `${elNamespace}-${names.join('-')}`
// 获取element-plus的css变量
export const getElVar = (...names: string[]) => `var(${makeElVar(...names)})`
// 生成element-plus的css变量名
export const makeElVar = (...names: string[]) => `--${elNamespace}-${names.join('-')}`

// 获取应用的类名
export const getAppClass = (...names: string[]) => `${appNamespace}-${names.join('-')}`
// 获取应用的css变量
export const getAppVar = (...names: string[]) => `var(${makeAppVar(...names)})`
// 生成应用的css变量名
export const makeAppVar = (...names: string[]) => `--${appNamespace}-${names.join('-')}`

// UI设计稿尺寸
export const uiScreen = {
  width: 1440,
  height: 900,
}
